package com.scott.role.controller;

import com.scott.role.bean.RoleBean;
import com.scott.role.dto.RoleDTO;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 黄后林
 * @version 1.0
 * @date 2021-11-23 09:58:24
 */

@RestController
@RequestMapping("role")
public class RoleController {


    /**
     * 方法描述: 方法描述:http://localhost:8080/role/delete8  POST
     *{
     * 	"ids":[10010,10020]
     *
     * }
     * @author: 黄后林
     * @date: 2021/11/23 11:30
     * @param dto
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "delete8",method= RequestMethod.POST)
    public RoleBean deleteByIds2(@RequestBody RoleDTO dto){

        System.out.println(dto);

        return null;
    }
    /**
     * 方法描述: 方法描述:http://localhost:8080/role/delete2  POST
     *{
     * 	"ids":[10010,10020]
     *
     * }
     * @author: 黄后林
     * @date: 2021/11/23 11:30
     * @param ids
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "delete2",method= RequestMethod.POST)
    public RoleBean deleteByIds2(@RequestBody Map ids){

        System.out.println(ids);

        return null;
    }


    /**
     * 方法描述: 方法描述:http://localhost:8080/role/delete  POST
     *
     * [10010,10020]
     * @author: 黄后林
     * @date: 2021/11/23 11:30
     * @param idList
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "delete",method= RequestMethod.POST)
    public RoleBean deleteByIds(@RequestBody List<Integer> idList){

        System.out.println(idList);

        return null;
    }




    /**
     * 方法描述:http://localhost:8080/role/add4  POST
     * {
     * 	"id":10010,
     * 	"productName":"手机"
     * }
     * 项目组：如果前后台都是你写得  你可以这么玩  优点 少些1个类 而且这个类的属性可以无限增多
     * 如果是前后端分离 建议写成对象  这样容易知道key叫啥
     * @author: 黄后林
     * @date: 2021/11/23 11:20
     * @param  
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "add4",method= RequestMethod.POST)
    public RoleBean add4(@RequestBody Map map){

        System.out.println(map);

        return null;
    }

    /**
     * 方法描述: http://localhost:8080/role/add3  POST
     * {
     * 	"id":10010,
     * 	"roleName":"学生"
     * }
     * @author: 黄后林
     * @date: 2021/11/23 11:04
     * @param role
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "add3",method= RequestMethod.POST)
    public RoleBean add2(@RequestBody RoleBean role){

        System.out.println("id="+role.getId());
        System.out.println("roleName="+role.getRoleName());
        return null;
    }

    /**
     * 方法描述: http://localhost:8080/role/add2?id=10010&roleName=学生  POST
     * @author: 黄后林
     * @date: 2021/11/23 10:59
     * @param id
     * @param roleName
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "add2",method= RequestMethod.POST)
    public RoleBean add2(Integer id,String roleName){

        System.out.println("id="+id);
        System.out.println("roleName="+roleName);
        return null;
    }

    /**
     * 方法描述:http://localhost:8080/role/find/rest/10010
     * @author: 黄后林
     * @date: 2021/11/23 10:46
     * @param id
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping(value = "find/rest/{id}",method= RequestMethod.GET)
    public RoleBean findRoleByIdRest2(@PathVariable(value = "id") Integer id){

        System.out.println("id="+id);
        return null;
    }


    /**
     * 方法描述:http://localhost:8080/role/find/10010
     * @author: 黄后林
     * @date: 2021/11/23 10:46
     * @param id
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping("find/{id}")
    public RoleBean findRoleByIdRest(@PathVariable(value = "id") Integer id){

        System.out.println("id="+id);
        return null;
    }


    /**
     * 方法描述: http://localhost:8080/role/find?id=10010
     * @author: 黄后林
     * @date: 2021/11/23 10:44
     * @param id
     * @return com.scott.role.bean.RoleBean
     */
    @RequestMapping("find")
    public RoleBean findRoleById(Integer id){

        System.out.println("id="+id);
        return null;
    }


    /**
     * 方法描述: http://localhost:8080/role/add
     * @author: 黄后林
     * @date: 2021/11/23 10:29
     * @param
     * @return java.util.Map
     */
    @RequestMapping("add")
    public Map<String, Object> addRole(){
        Map<String,Object> rs = new HashMap<>();
        rs.put("code",200);
        rs.put("message","role");
        return rs;
    }
}
